// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/leader/index',
    children: [
      {
        path: '/leader',
        name: 'leader',
        redirect: '/leader/index',
        component: RouteView,
        meta: { title: '工作总览', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/leader/index',
            name: 'LeaderIndex',
            component: () => import('@/views/leader/LeaderIndex'),
            meta: { title: '组长首页', keepAlive: true }
          },
          {
            path: '/leader/cso',
            name: 'CsoIndex',
            component: () => import('@/views/leader/CsoIndex'),
            meta: { title: '总监首页', keepAlive: true }
          },
          {
            path: '/console/index',
            name: 'Console',
            component: () => import('@/views/console/Console'),
            meta: { title: '监控中心', keepAlive: true }
          },
          {
            path: '/performance/index',
            name: 'PerformanceIndex',
            component: () => import('@/views/performance/PerformanceIndex'),
            meta: { title: '数据中心', keepAlive: true }
          }
        ]
      },
      {
        path: '/member',
        name: 'member',
        redirect: '/member/list',
        component: RouteView,
        meta: { title: '组员管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/member/list',
            name: 'MemberList',
            component: () => import('@/views/member/MemberList'),
            meta: { title: '组员列表', keepAlive: true }
          },
          {
            path: '/member/setting',
            name: 'MemberSetting',
            component: () => import('@/views/member/MemberSetting'),
            meta: { title: '组员设置', keepAlive: true }
          },
          {
            path: '/member/detail',
            name: 'MemberDetail',
            component: () => import('@/views/member/MemberDetail'),
            meta: { title: '组员详情', keepAlive: true }
          },
          {
            path: '/member/kq',
            name: 'MemberKq',
            component: () => import('@/views/member/MemberKq'),
            meta: { title: '组员考勤', keepAlive: true }
          },
          {
            path: '/member/check',
            name: 'MemberCheck',
            component: () => import('@/views/member/MemberCheck'),
            meta: { title: '组员审核', keepAlive: true }
          }
        ]
      },
      {
        path: '/customer',
        name: 'customer',
        redirect: '/customer/list',
        component: RouteView,
        meta: { title: '客户管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/customer/list',
            name: 'CustomerList',
            component: () => import('@/views/customer/CustomerList'),
            meta: { title: '客户列表', keepAlive: true }
          },
          {
            path: '/customer/detail',
            name: 'CustomerDetail',
            component: () => import('@/views/customer/CustomerDetail'),
            meta: { title: '客户详情', keepAlive: true }
          },
          {
            path: '/customer/question',
            name: 'QstList',
            component: () => import('@/views/customer/QstList'),
            meta: { title: '问题客户', keepAlive: true }
          }
        ]
      },
      {
        path: '/contract',
        name: 'contract',
        redirect: '/contract/list',
        component: RouteView,
        meta: { title: '合同管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/contract/list',
            name: 'ContractList',
            component: () => import('@/views/contract/ContractList'),
            meta: { title: '组员合同', keepAlive: true }
          },
          {
            path: '/contract/refund',
            name: 'RefundList',
            component: () => import('@/views/contract/RefundList'),
            meta: { title: '退款审批', keepAlive: true }
          },
          {
            path: '/contract/detail',
            name: 'ContractDetail',
            component: () => import('@/views/contract/ContractDetail'),
            meta: { title: '合同详情', keepAlive: true }
          }
        ]
      },
      {
        path: '/business',
        name: 'business',
        redirect: '/business/list',
        component: RouteView,
        meta: { title: '业务管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/business/list',
            name: 'BusinessList',
            component: () => import('@/views/business/BusinessList'),
            meta: { title: '组员业务', keepAlive: true }
          },
          {
            path: '/business/detail',
            name: 'BusinessDetail',
            component: () => import('@/views/business/BusinessDetail'),
            meta: { title: '业务详情', keepAlive: true }
          }
        ]
      },
      {
        path: '/calls',
        name: 'calls',
        redirect: '/calls/all',
        component: RouteView,
        meta: { title: '通话管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/calls/all',
            name: 'AllCalls',
            component: () => import('@/views/calls/AllCalls'),
            meta: { title: '所有通话', keepAlive: true }
          }
        ]
      },
      {
        path: '/schedule',
        name: 'schedule',
        redirect: '/schedule/settings',
        component: RouteView,
        meta: { title: '排班管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/schedule/settings',
            name: 'ScheduleSetting',
            component: () => import('@/views/schedule/ScheduleSetting'),
            meta: { title: '排班设置', keepAlive: true }
          },
          {
            path: '/performance/plan',
            name: 'SchedulePlan',
            component: () => import('@/views/schedule/SchedulePlan'),
            meta: { title: '排班预设方案', keepAlive: true }
          }
        ]
      },
      {
        path: '/other',
        name: 'other',
        redirect: '/other/change',
        component: RouteView,
        meta: { title: '其他管理', keepAlive: true, icon: bxAnaalyse },
        children: [
          {
            path: '/other/change',
            name: 'ChangePassword',
            component: () => import('@/views/other/ChangePassword'),
            meta: { title: '修改密码', keepAlive: true }
          },
          {
            path: '/business/price',
            name: 'BusinessPrice',
            component: () => import('@/views/other/BusinessPrice'),
            meta: { title: '业务价格', keepAlive: true }
          },
          {
            path: '/search',
            name: 'SearchIndex',
            hidden: true,
            component: () => import('@/views/other/Search'),
            meta: { title: '全局搜索', keepAlive: true }
          }
        ]
      }
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/redirect/:path*',
    hidden: true,
    component: () => import('@/views/redirect/index')
  },
  {
    path: '/user/login',
    name: 'UserLogin',
    hidden: true,
    component: () => import('@/views/user/Login'),
    meta: { title: '用户登录', keepAlive: true }
  },
  {
    path: '/404',
    name: 'notFound',
    component: () => import('@/views/404')
  }
]
